package com.wyz.note.basics.strategy;

/**
 * @Description: 价格处理类
 * @author: wei yz
 * @Date: 2024/1/14 14:27
 */
public class PriceHandle {
    private MemberService memberService;

    public void setMemberInterface(MemberService memberService) {
        this.memberService = memberService;
    }

    /**
     * 计算出需要支付的费用
     *
     * @return
     */
    public Double getMemberPrice(Double price) {
        Double postage = 5.0;
        if (memberService.isFreeShipping()) {
            postage = 0.0;
        }
        return (memberService.getPrice(price) + postage);
    }
}
